#include "ftpsetupdialog.h"
#include "ui_ftpsetupdialog.h"

#include "../Global/commondefs.h"
#include <QSettings>

FtpSetupDialog::FtpSetupDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FtpSetupDialog)
{
    ui->setupUi(this);
    QSettings s;
    ui->ipEdit->setText(s.value(NW_FTP_IP, "121.41.11.239").toString());
    ui->portSpin->setValue(s.value(NW_FTP_PORT, 21).toUInt());
    ui->userEdit->setText(s.value(NW_FTP_USER, "uftp").toString());
    ui->pwdEdit->setText(s.value(NW_FTP_PWD, "JFaabbcc123com").toString());
}

FtpSetupDialog::~FtpSetupDialog()
{
    delete ui;
}

void FtpSetupDialog::on_okBtn_clicked()
{
    QSettings s;
    s.setValue(NW_FTP_IP, ui->ipEdit->text());
    s.setValue(NW_FTP_PORT, ui->portSpin->value());
    s.setValue(NW_FTP_USER, ui->userEdit->text());
    s.setValue(NW_FTP_PWD, ui->pwdEdit->text());
}
